<template>
  <div class="member-home">
    <!-- 概览 -->
    <HomeOverview />
    <!-- 收藏 -->
    <HomePanel title="我的收藏" v-if="collect">
      <GoodsItem :goods="item" v-for="item in collect.items" :key="item.id"/>
    </HomePanel>
    <!-- 足迹 -->
    <HomePanel title="我的足迹" v-if="looked">
      <GoodsItem :goods="item" v-for="item in looked.items" :key="item.id"/>
    </HomePanel>
    <!-- 猜你 -->
    <GoodsRelevant />
  </div>
</template>
<script>
import GoodsItem from '@/views/category/components/CategoryGoods.vue'
import HomeOverview from './components/homeOverView.vue'
import HomePanel from './components/homePanel.vue'
import GoodsRelevant from '@/views/goods/components/goodsRelevant.vue'
import request from '@/utils/request'
import { ref } from 'vue'
import { findCollect } from '@/api/index'
import { findLooked } from '@/api/index'
export default {
  name: 'MemberHome',
  components:{HomePanel, HomeOverview, GoodsRelevant, GoodsItem},
  setup(){
    const goods = {
      id: '1',
      name: '自煮火锅不排队 麦饭石不粘鸳鸯火锅',
      picture: 'https://yanxuan-item.nosdn.127.net/fcdcb840a0f5dd754bb8fd2157579012.jpg',
      desc: '清汤鲜香 红汤劲爽',
      price: '159.00'
    }
    request('/my/test', 'get').then(data=>{
      console.log(data)
    })
    // 我的收藏
    const collect = ref([])
    findCollect({page:1,pageSize:4}).then(data=>{
      collect.value = data.result
      console.log(data.result,'166666')
    })
    // 我的足迹
    const looked = ref([])
    findLooked({page:1,pageSize:4}).then(data=>{
      looked.value = data.result
    })
    return {goods, collect, looked}
  }
}
</script>
<style scoped lang="less">
:deep(.xtx-carousel) .carousel-btn.prev {
  left: 5px;
}
:deep(.xtx-carousel) .carousel-btn.next {
  right: 5px;
}

</style>